<?php

$event = $this->event;

foreach($this->vote_info as $thread_id=>$thread){
    if(count($thread) >= 1){
        foreach($thread as $phase_id=>$phase){         
            $voteImgArr = array();
            if($phase->view_enable ==1 && isset($this->imgList[$phase->thid][$phase->pid])
            && is_array($this->imgList[$phase->thid][$phase->pid]) && count($this->imgList[$phase->thid][$phase->pid])>0){
                $voteImgArr = $this->imgList[$phase->thid][$phase->pid];

                $photo_block_id = $thread_id."_".$phase_id;
                $photo_block_title = $phase->thread_name.($phase->phase_name != ""?" - ".$phase->phase_name:"");
?>
			<!--Photo:-->
				<a name="mark_photo_<?=$photo_block_id?>"></a>
                <div id="photo" class="event-area">
                    <div class="event-header-long">
                        <span class="value"><a href="<?php
							if($phase->votephoto_category > 0)
								echo 'http://photo.tamtay.vn/category/browse/'.$phase->votephoto_category;
							else 
								echo "/event/".$event->short_cut."/votedlist/".$thread_id."/".$phase_id;
								?>" title="<?=$photo_block_title?>"><?=$photo_block_title?></a></span>      </div>
      					<div class="event-content-long" style="padding-left:35px;">
						<!--Photo Content-->
						<?php if(is_array($voteImgArr) && count($voteImgArr)>0){?>
						<ul class="photo-group" style="margin-top:10px;">
						<?php 
							for($i=0; $i<count($voteImgArr) && $i<4; $i++){
								$imgObj = $voteImgArr[$i];
							?>
                        	<li class="photo-item">
                                <div class="wrapEventNew01" style="float:left; margin-bottom: 5px;">
                                    <div class="wrapEventNew02">
                            	        <a href="http://photo.tamtay.vn/photo/view/<?php echo $imgObj->aid;?>" target="_blank">
						                    <img src="<?php echo EVENT_IMG_SERVER.$imgObj->thumbnail;?>"  onload="resizeImage(this,125, 100)" />
						                </a>
                                    </div>
                                </div>
                                <a href="http://photo.tamtay.vn/photo/view/<?php echo $imgObj->aid;?>" target="_blank">
                                    <?php echo $imgObj->album_name;?>
                                </a>
                            </li>
						<?php 
							}	// End of for
						?>
                        </ul>
                        <?php } // End of if?>
                        <?php if(is_array($voteImgArr) && count($voteImgArr)>4){?>
                        <ul class="photo-group">
						<?php 
							for($i=4; $i<count($voteImgArr) && $i<8; $i++){
								$imgObj = $voteImgArr[$i];
							?>
                        	<li class="photo-item<?php echo $i==4?" clear-left":""; ?>">
                            	<div class="wrapEventNew01" style="float:left; margin-bottom: 5px;">
                                    <div class="wrapEventNew02">
                                        <a href="http://photo.tamtay.vn/photo/view/<?php echo $imgObj->aid;?>" target="_blank">
                                            <img src="<?php echo EVENT_IMG_SERVER.$imgObj->thumbnail;?>" onload="resizeImage(this,125, 100)" />
                                        </a>
                                    </div>
                                </div>
                                <a href="http://photo.tamtay.vn/photo/view/<?php echo $imgObj->aid;?>" target="_blank">
                                    <?php echo $imgObj->album_name;?>
                                </a>
                            </li>
						<?php 
							} // End of for
						?>
                        </ul>
                        	
                        <?php } // End of if?>
                        <?php if(is_array($voteImgArr) && count($voteImgArr)>8){?>
                        <ul class="photo-group">
						<?php 
							for($i=8; $i<count($voteImgArr) && $i<12; $i++){
								$imgObj = $voteImgArr[$i];
							?>
                        	<li class="photo-item<?php echo $i==8?" clear-left":""; ?>">
                            	<div class="wrapEventNew01" style="float:left; margin-bottom: 5px;">
                                    <div class="wrapEventNew02">
                                        <a href="http://photo.tamtay.vn/photo/view/<?php echo $imgObj->aid;?>" target="_blank">
                                            <img src="<?php echo EVENT_IMG_SERVER.$imgObj->thumbnail;?>" onload="resizeImage(this,125, 100)" />
                                        </a>
                                    </div>
                                </div>
                                <a href="http://photo.tamtay.vn/photo/view/<?php echo $imgObj->aid;?>" target="_blank">
                                    <?php echo $imgObj->album_name;?>
                                </a>
                            </li>
						<?php 
							} // End of for
						?>
                        </ul>
                        	
                        <?php } // End of if?>
                        <?php if(is_array($voteImgArr) && count($voteImgArr)>12){?>
                        <ul class="photo-group">
						<?php 
							for($i=12; $i<count($voteImgArr) && $i<16; $i++){
								$imgObj = $voteImgArr[$i];
							?>
                        	<li class="photo-item<?php echo $i==12?" clear-left":""; ?>">
                            	<div class="wrapEventNew01" style="float:left; margin-bottom: 5px;">
                                    <div class="wrapEventNew02">
                                        <a href="http://photo.tamtay.vn/photo/view/<?php echo $imgObj->aid;?>" target="_blank">
                                            <img src="<?php echo EVENT_IMG_SERVER.$imgObj->thumbnail;?>" onload="resizeImage(this,125, 100)" />
                                        </a>
                                    </div>
                                </div>
                                <a href="http://photo.tamtay.vn/photo/view/<?php echo $imgObj->aid;?>" target="_blank">
                                    <?php echo $imgObj->album_name;?>
                                </a>
                            </li>
						<?php 
							} // End of for
						?>
                        </ul>
                        	
                        <?php } // End of if?>
                        <?php if(is_array($voteImgArr) && count($voteImgArr)>16){?>
                        <ul class="photo-group">
						<?php 
							for($i=16; $i<count($voteImgArr) && $i<20; $i++){
								$imgObj = $voteImgArr[$i];
							?>
                        	<li class="photo-item<?php echo $i==16?" clear-left":""; ?>">
                            	<div class="wrapEventNew01" style="float:left; margin-bottom: 5px;">
                                    <div class="wrapEventNew02">
                                        <a href="http://photo.tamtay.vn/photo/view/<?php echo $imgObj->aid;?>" target="_blank">
                                            <img src="<?php echo EVENT_IMG_SERVER.$imgObj->thumbnail;?>" onload="resizeImage(this,125, 100)" />
                                        </a>
                                    </div>
                                </div>
                                <a href="http://photo.tamtay.vn/photo/view/<?php echo $imgObj->aid;?>" target="_blank">
                                    <?php echo $imgObj->album_name;?>
                                </a>
                            </li>
						<?php 
							} // End of for
						?>
                        </ul>
                        	
                        
                        <?php } ?>
						<div class="clear"></div>

						<!--End Photo Content-->
							<div class="text-right viewmore"><a href="<?php
							if($phase->votephoto_category > 0)
								echo 'http://photo.tamtay.vn/category/browse/'.$phase->votephoto_category;
							else 
								echo "/event/".$event->short_cut."/votedlist/".$thread_id."/".$phase_id;
								?>">Xem tiếp &raquo;</a></div>
						</div>
                </div>
                <!--End photo-->
				
<?php 
            }
        }
    }
    
} ?>